package com.industrial.system.aware;


import com.industrial.system.api.domain.SysDictData;
import com.industrial.system.service.ISysDictTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.util.List;

@Component
public class LoadIsOriginalWhitelistToRedis {

    @Autowired
    private ISysDictTypeService dictTypeService;

    @Autowired
    private RedisTemplate<String, String> redisTemplate;

    @PostConstruct
    public void init(){
        List<SysDictData> tjcj = dictTypeService.selectDictDataByType("is_original_whitelist");
        for(SysDictData sysDictData : tjcj){
            redisTemplate.opsForHash().put("whitelist",sysDictData.getDictValue(),sysDictData.getDictLabel());
        }
    }

}
